home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Examples / NX_Invaders / AnimTester / GameBrain.h < prev    next >
Encoding:
Text File  |  1995-06-12  |  3.3 KB  |  78 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. // This handles a lot of the logic of the game; it has application delegate
  5. // methods to deal with start up and shut down of the application.  It also
  6. // has some window delegate methods that work in conjunction with the game
  7. // window (window with the playing field).  It starts and stops the game,
  8. // odes pausing, makes sure initialization is done properly, moves from
  9. // level to level, and tracks the score along with various bonuses.
  10.  
  11. #import <objc/Object.h>     // superclass
  12. #import <objc/typedstream.h>    // highscore tables
  13. #import <appkit/appkit.h>     // matrix controls' methods
  14. #import "GameView.h"        // the brain's partner in crime
  15. #import "HighScoreTable.h"    // to handle high scores
  16.  
  17. @interface GameBrain:Object
  18. {
  19.     id    alert;                // tells user to wait during load
  20.     id    levelText;            // textField on status window
  21.     id    gameScreen;            // gameView instance    
  22.     id    topScoreText;        // high score textField on status window
  23.     id    scoreText;            // score textField on status window
  24.     id  pauseMenuCell;        // menuCell that pauses/unpauses game
  25.     id  gameWindow;            // window holding gameView
  26.     id    highScoreTable;        // object to handle High Scores
  27.     id  preferencesBrain;    // object to handle Preferences Panel
  28.     id  infoController;        // object to put out info/help panels
  29.     id  soundPlayer;        // the object handling the sounds
  30.     id  loadingPanel;        // to tell the user we're awake
  31.     id  fruitBasket;        // displays fruit for each level
  32.     id  pacsLeft;            // displays PacMen left
  33.         
  34.     BOOL paused;            // game is paused flag
  35.     BOOL ranOnce;            // did the player at least play one game?
  36.     
  37.     // instance variables to hold preferences and game status:
  38.     int score, level, viruses, speed, ghostCount, pointsToNextBonus, lastBonus;
  39. }
  40.  
  41. - init;                    // designated initializer
  42. - (int)level;            // returns current play level
  43. - (int)speed;            // returns speed
  44.  
  45. - zeroScore;
  46. - addToScore:(int)increment;    // add an int to the score
  47. - gameOver;            // end the game & wrap it up, disp. "game over" 
  48. - (int)pause;        // pause the game - internal method
  49. - (int)paused;        // are we paused?
  50. - unpause;            // unpause the game - internal method
  51. - showHigh;            // update the "high score field    
  52.     // Interface Builder (IB) methods:
  53. - pauseGame:sender;        // to be sent by menu item
  54. - startNewGame:sender;        // called by New Game menu item and on startup
  55. - unpauseGame:sender;        // same as pauseGame:
  56. - gameOver:sender;        // sent by gameScreen when game is over.
  57. - nextLevel:sender;        // advance game to next level - internal
  58.  
  59. - (int)ateGhost;    // eating ghosts is tracked by these methods since
  60. - resetGhostScore;    // the score depends on how many ghosts are eaten
  61.  
  62. - appWillInit:sender;        // puts up loading alert.
  63. - appDidInit:sender;        // starts up the game on launch
  64. - appDidBecomeActive:sender;    // reactivates the game
  65. - appDidHide:sender;        // deactivates the game
  66. - appDidResignActive:sender;    // reactivates the game
  67. - appDidUnhide:sender;        // deactivates the game
  68. - appWillTerminate:sender;    // saves high scores and preferences
  69. - quit:sender;            // to catch the "quit" menu item
  70.  
  71. - windowDidResginMain:sender;    // do pause if window loses main status
  72. - windowDidResignKey:sender;    // do pause if window loses key status
  73. - windowDidBecomeKey:sender;    // do unpause if window gains key status 
  74. - windowDidMove:sender;        // move fruit basket and status with game window 
  75.  
  76.  
  77. @end
  78.